class Animal(object):
    """定义动物类"""
    name = ""
    time = 0

    def __init__(self, name, time):
        self.setName(name)
        self.setTime(time)

    def setName(self, name):
        self.name = name

    def setTime(self, time):
        if not isinstance(time, int):
            print('必须是整数')
        self.time = time

    def say(self):
        print("动物名称: " + self.name)

class Person(object):
    """定义人类"""
    name = ""

    def __init__(self, name):
        self.setName(name)

    def setName(self, name):
        self.name = name

    def own(self, name):
        name.feed(self.name)

class Cat(Animal):
    """定义猫类"""
    color = ""

    def __init__(self, name, time):
        Animal.__init__(self, name, time)

    def say(self):
        Animal.say(self)
        print("喵喵，我是" + self.name)

    def feed(self,name):
        self.time += 1
        print(name+"喂了"+self.name+"一次")


class Dog(Animal):
    """定义狗类"""
    color = ""

    def __init__(self, name, time):
        Animal.__init__(self, name, time)

    def say(self):
        Animal.say(self)
        print("汪汪，我是" + self.name)

    def feed(self,name):
        self.time += 1
        print(name+"喂了" + self.name + "一次")


if __name__ == "__main__":
    Cat1 = Cat("布丁", 0 )
    Dog1 = Dog("锤子", 0 )
    Person1 = Person("张三")
    Cat1.say()
    Dog1.say()
    Person1.own(Cat1)
    Person1.own(Dog1)

